home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Frameworks / Sprocket Framework DR2 / Sprocket Framework Interfaces / SprocketMacros.h < prev    next >
Text File  |  1996-04-16  |  1KB  |  37 lines

  1. // Sprocket Framework header file
  2. // SprocketMacros.h
  3.  
  4.  
  5. #if    qDebug
  6.  
  7. #if GENERATINGPOWERPC
  8. #define    DebugMessage(x)    DebugStr(x)
  9. #else
  10. #define    DebugMessage(x)    SysBreakStr(x)
  11. #endif
  12.  
  13. #if GENERATINGPOWERPC
  14. inline    void DebugNum(long x) {Str255 s; NumToString(x, s); DebugStr(s);}
  15. #else
  16. inline    void DebugNum(long x) {Str255 s; NumToString(x, s); SysBreakStr(s);}
  17. #endif
  18.  
  19. #else
  20.  
  21. #define    DebugMessage(x)
  22. #define DebugNum(x)
  23.  
  24. #endif
  25.  
  26. inline void FailErr(OSErr theErr)            { if(theErr != noErr) throw(theErr); }
  27. inline void FailOSErr(OSErr theErr)            { FailErr(theErr); }
  28. inline void FailResError()                    { FailErr(ResError()); }
  29. inline void FailMemError()                    { FailErr(MemError()); }
  30. inline void FailNil(void* ptr)                { if(ptr == nil) throw(nilHandleErr); }
  31. inline void FailResErrorOrNil(void* ptr)    { FailResError(); FailNil(ptr); }
  32. inline void FailMemErrorOrNil(void* ptr)    { FailMemError(); FailNil(ptr); }
  33.  
  34.  
  35. inline Point TopLeft( Rect& r )                { return *(Point *) &(r).top; }
  36. inline Point BotRight( Rect& r )            { return *(Point *) &(r).bottom; }
  37.